home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / wemdemo4.zip / INFO / WINEMACS.1 (.txt) < prev    next >
GNU Info File  |  1994-09-21  |  50KB  |  859 lines

  1. This is Info file ../info/winemacs, produced by Makeinfo-1.56 from the
  2. input file winemacs.txi.
  3. File: winemacs,  Node: Top,  Next: License,  Prev: (dir),  Up: (dir)
  4.    Win-Emacs is a Microsoft Windows version of the popular and powerful
  5. editor GNU Emacs and also includes ports of grep, diff, and patch.
  6. Win-Emacs is produced by Pearl Software.
  7. * Menu:
  8. * License::            The license that governs Win-Emacs.
  9. * Introduction::        What is Win-Emacs?
  10. * Getting Started::        How to set up and run Win-Emacs.
  11. * Overview of Win-Emacs::    Use of the mouse, keyboard, etc.
  12. * More About Win-Emacs::    Advanced techniques.
  13. * Other Packages::              More things you can do with Win-Emacs.
  14. * Customization::        Binding keys, changing fonts, etc.
  15. * More Documentation::        When this guide isn't enough.
  16. * Bugs/Help/Crashes::        When something goes wrong.
  17. * Differences From Other Emacsen:: (Yes, that's the correct plural.)
  18. * Source Code::            How to get the source code.
  19. * Contacting Pearl Software::    Contacting the authors of Win-Emacs.
  20. File: winemacs,  Node: License,  Next: Introduction,  Prev: Top,  Up: Top
  21. License
  22. *******
  23.    Pearl Software has ported GNU Emacs to Windows.  To run, it requires
  24. an X Windows emulation package.  One such emulation package, WIN-X, is
  25. provided on this disk.  WIN-X is Pearl proprietary.  The license
  26. agreement for the proprietary WIN-X package may be found in the file
  27. `license.txt' after installation.
  28.      THE FREE SOFTWARE FOUNDATION'S GNU EMACS IS PROVIDED AT NO CHARGE
  29.      UNDER THE TERMS OF THE FREE SOFTWARE FOUNDATION'S GENERAL PUBLIC
  30.      LICENSE.  THE GENERAL PUBLIC LICENSE MAY BE VIEWED BY INSTALLING
  31.      THE SOFTWARE AND TYPING `CONTROL-H' FOLLOWED BY `CONTROL-C' OR BY
  32.      VIEWING THE FILE `COPYING' IN THE `info' DIRECTORY AFTER
  33.      INSTALLATION.
  34.    The reason we consider WIN-X and GNU Emacs two separate programs, and
  35. not two parts of one program, is that each makes sense separately.
  36. WIN-X is a general emulator for X Windows, and this version of GNU Emacs
  37. has no modifications specific to use with WIN-X.  It could run with any
  38. X Windows emulator (or, on other systems, with X Windows).
  39. File: winemacs,  Node: Introduction,  Next: Getting Started,  Prev: License,  Up: Top
  40. Introduction
  41. ************
  42.    Welcome to Win-Emacs!
  43.    Win-Emacs is a version of the popular GNU Emacs programming editor
  44. that runs under Microsoft Windows.  Win-Emacs requires Windows 3.1
  45. running on a machine with a 386 or better processor and at least 6
  46. megabytes of memory.  9 megabytes of free hard-disk space is required
  47. for a complete distribution.
  48.    Win-Emacs also includes full 32-bit ports of the GNU versions of the
  49. popular Unix utilities grep, diff, and patch.
  50.    GNU Emacs is a powerful, customizable programming editor that is also
  51. available on nearly every variety of Unix, on Vax VMS, and on most other
  52. operating systems.  Win-Emacs is a complete implementation of GNU Emacs,
  53. meaning that the features you may be used to in other versions of GNU
  54. Emacs will be present in Win-Emacs.
  55.    Win-Emacs is based on Lucid GNU Emacs 19.6 (now called XEmacs),
  56. which is a version of GNU Emacs that provides extensive windowing and
  57. GUI (graphical user interface) features and runs under Unix on the X
  58. Window System.  Although there are other windowing versions of GNU
  59. Emacs, Lucid Emacs is the most powerful and best-designed, and is the
  60. only version supported by large software companies (Sun Microsystems
  61. Inc., Amdahl, and others); this is why we chose to base Win-Emacs on it.
  62.    This manual assumes that you have some knowledge of how to use some
  63. version of Emacs (although not necessarily a windowing version).  If
  64. you are unfamiliar with Emacs, choose the `Emacs Tutorial' option from
  65. the `Help' menu for a quick introduction to editing with Emacs.
  66.    This manual is available both as a printed document and on-line, by
  67. choosing the `Info' option from the `Help' menu and selecting
  68. `Win-Emacs'.  There is also extensive on-line reference documentation
  69. describing Win-Emacs, E-Lisp (the dialect of the Lisp language that is
  70. used to customize Win-Emacs), and various associated packages.
  71.    If, after reading this manual, you have further questions or comments
  72. about Win-Emacs, feel free to contact Pearl Software (*note Contacting
  73. Pearl Software::.).
  74. File: winemacs,  Node: Getting Started,  Next: Overview of Win-Emacs,  Prev: Introduction,  Up: Top
  75. Getting Started
  76. ***************
  77.    This chapter explains how to install Win-Emacs on your system and
  78. get it up and running.
  79. * Menu:
  80. * Installation::
  81. * Configuring Your System for Win-Emacs::
  82. * Running Win-Emacs::
  83. File: winemacs,  Node: Installation,  Next: Configuring Your System for Win-Emacs,  Up: Getting Started
  84. Installation
  85. ============
  86.    * If you received Win-Emacs on floppies:
  87.      Installation is accomplished through the `SETUP.EXE' program
  88.      located on the disk `Win-Emacs 1' in the distribution.  Insert this
  89.      disk in drive A and type `A:SETUP' from a DOS prompt; or from
  90.      within Windows, select the `Run' command from the `File' menu in
  91.      Program Manager and type `A:SETUP.EXE'.  Setup will start Windows
  92.      automatically if it is not currently running, and will allow you to
  93.      select the sections of Emacs you wish to install.  The "Core
  94.      Program Files" must be installed in order for Emacs to work.  This
  95.      includes the binaries, compiled Emacs-Lisp files, and files in the
  96.      `etc' subdirectory.  "Emacs Info" refers to the online
  97.      documentation files; you may choose not to install these files if
  98.      you wish.
  99.    * If you downloaded a demo version by FTP or off of a CD-ROM:
  100.      You will need to unpack the files from whatever form they are in.
  101.      If they are in a `.ZIP' file, this file should be unpacked using
  102.      `PKUNZIP -d'. (The `-d' option is important - it creates the
  103.      necessary subdirectories.) You need to use version 2.0 or greater
  104.      of `PKUNZIP'.  If the files have already been unpacked, you simply
  105.      need to copy them into the proper location (e.g. using `XCOPY'),
  106.      making sure to preserve the subdirectory structure.  If there is
  107.      not already a subdirectory `LOCK' off of the top-level directory,
  108.      you must create it.
  109. File: winemacs,  Node: Configuring Your System for Win-Emacs,  Next: Running Win-Emacs,  Prev: Installation,  Up: Getting Started
  110. Configuring Your System for Win-Emacs
  111. =====================================
  112. * Menu:
  113. * Setting Up Your Path::                        May not be necessary.
  114. * Increasing Your Virtual Memory::              Highly recommended.
  115. * Specifying the Location of Startup Files::    Optional.
  116. File: winemacs,  Node: Setting Up Your Path,  Next: Increasing Your Virtual Memory,  Up: Configuring Your System for Win-Emacs
  117. Setting Up Your Path
  118. --------------------
  119.    If you plan on using the utilities `etags', `grep', `diff', or
  120. `patch' from MS-DOS or from a DOS box inside of Windows, you need to
  121. add the `etc' subdirectory (for example, `c:\winemacs\etc' if you
  122. installed Win-Emacs in `c:\winemacs') to your PATH (usually specified
  123. in your `AUTOEXEC.BAT' file).  Note that you do not have to do this if
  124. you only use these utilities from inside Win-Emacs: it knows how to
  125. find them regardless of your PATH.
  126.    Your PATH cannot be longer than 128 characters; if this becomes a
  127. problem, one trick is to use the MS-DOS `SUBST' command.  For example,
  128. if `H:' does not refer to an existing drive, add a line like
  129.      subst h: c:\winemacs\etc
  130.    to your `AUTOEXEC.BAT' file, and then add `H:\' to your PATH.  This
  131. same trick can be used multiple times (with different drive letters, of
  132. course) to reduce the length of your PATH.  Note that you may have to
  133. add a line like
  134.      lastdrive=h
  135.    to your `CONFIG.SYS' file.  See your MS-DOS manual for details.
  136. File: winemacs,  Node: Increasing Your Virtual Memory,  Next: Specifying the Location of Startup Files,  Prev: Setting Up Your Path,  Up: Configuring Your System for Win-Emacs
  137. Increasing Your Virtual Memory
  138. ------------------------------
  139.    Win-Emacs uses a fair amount of memory in normal operation and does
  140. not perform well in low-memory conditions.  We recommend that you have
  141. at least 20 megabytes of virtual memory. (Note that this does *not*
  142. mean that you actually need this much RAM in your system!  A normal
  143. amount like 8 megabytes of RAM should do.)
  144.    To increase the amount of virtual memory, go into Control Panel and
  145. select the `386 Enhanced' icon; then click on the button labeled
  146. `Virtual Memory'.
  147. File: winemacs,  Node: Specifying the Location of Startup Files,  Prev: Increasing Your Virtual Memory,  Up: Configuring Your System for Win-Emacs
  148. Specifying the Location of Startup Files
  149. ----------------------------------------
  150.    You can specify the directory where Win-Emacs looks for startup
  151. files by setting the environment variables `EMACSHOME' or `HOME'.  (If
  152. neither is set, Win-Emacs looks in `C:\'.) For more info, *Note
  153. Initialization Files::.
  154. File: winemacs,  Node: Running Win-Emacs,  Prev: Configuring Your System for Win-Emacs,  Up: Getting Started
  155. Running Win-Emacs
  156. =================
  157.    Once Win-Emacs has successfully been installed, you can run it in
  158. any of the following ways:
  159.   1. From File Manager, locate the file `WINEMACS.EXE' (this is in the
  160.      `bin' subdirectory of the directory you installed Win-Emacs in).
  161.      Double-click on it to run.
  162.   2. From Program Manager, select `Run' from the File menu and type in
  163.      the full pathname of `WINEMACS.EXE' (see option 1).
  164.   3. In Program Manager, create a program item and give the full
  165.      pathname of `WINEMACS.EXE' as the command line.  You may
  166.      optionally specify a directory that will be current when Win-Emacs
  167.      starts; this is the default directory when Win-Emacs searches for
  168.      files.  If you do not specify a current directory, the Windows
  169.      directory will be current.
  170. File: winemacs,  Node: Overview of Win-Emacs,  Next: More About Win-Emacs,  Prev: Getting Started,  Up: Top
  171. Overview of Win-Emacs
  172. *********************
  173. * Menu:
  174. * Using the Keyboard::
  175. * Using the Mouse::
  176. * Using the Menus::
  177. * Dialog Boxes::
  178. * Creating and Managing Multiple Screens::
  179. File: winemacs,  Node: Using the Keyboard,  Next: Using the Mouse,  Up: Overview of Win-Emacs
  180. Using the Keyboard
  181. ==================
  182.    Emacs was originally designed for use on character-mode terminals,
  183. which lacked menus and mice and often had no arrow or keypad keys;
  184. thus, it is completely controllable from the main portion of the
  185. keyboard.  However, you will probably find it easier to make use of the
  186. keypad, mouse, and menus.
  187.    For an introduction to how to control Emacs with the Keyboard, choose
  188. the `Emacs Tutorial' option from the `Help' menu.
  189.    The following keypad key combinations are defined:
  190.    *Movement Keys:*
  191. `Left', `Right'
  192.      Move backward or forward by one character.
  193. `Ctrl-Left', `Ctrl-Right'
  194.      Move backward or forward by one word.
  195. `Meta-Left', `Meta-Right'
  196.      Move backward or forward by one balanced expression or word.
  197. `Up', `Down'
  198.      Move up or down by one line.
  199. `Ctrl-Up', `Ctrl-Down'
  200.      Move up or down by one block (the definition of this is
  201.      mode-dependent).
  202. `Meta-Up', `Meta-Down'
  203.      Move backward or forward by one balanced group of parentheses.
  204. `PageUp', `PageDn'
  205.      Move up or down one page.
  206. `Meta-PageUp', `Meta-PageDn'
  207.      Scroll the other window up or down one page.
  208. `Home', `End'
  209.      Move to the beginning or end of the line.
  210. `Ctrl-Home', `Ctrl-End'
  211.      Move to the beginning or end of the buffer.
  212. `Meta-Home', `Meta-End'
  213.      Move to the beginning or end of the other window's buffer.
  214.    *Text Deletion/Insertion Keys:*
  215. `BackSpace', `Delete'
  216.      Delete the character before or after (at) point.
  217. `Meta-BackSpace', `Meta-Delete'
  218.      Delete the word before or after point.
  219. `Shift-Delete'
  220.      Equivalent to the `Cut' menu item.
  221. `Control-Insert'
  222.      Equivalent to the `Copy' menu item.
  223. `Shift-Insert'
  224.      Equivalent to the `Paste' menu item.
  225. `Control-Delete'
  226.      Equivalent to the `Clear' menu item.
  227.    *Other Keys:*
  228. `Ctrl-Tab', `Ctrl-Shift-Tab'
  229.      Switch to the next or previous window in this screen.
  230. `Insert'
  231.      Toggle between insert and overwrite mode.
  232. File: winemacs,  Node: Using the Mouse,  Next: Using the Menus,  Prev: Using the Keyboard,  Up: Overview of Win-Emacs
  233. Using the Mouse
  234. ===============
  235. * Menu:
  236. * The Left Mouse Button::    Position the cursor and select text.
  237. * The Middle Mouse Button::  Copy text (only on a three-button mouse).
  238. * The Right Mouse Button::   Bring up a popup menu.
  239. * Drag-and-Drop::            File Manager integration.
  240. * Remapping the Pointer::    Switching around the pointer buttons.
  241. File: winemacs,  Node: The Left Mouse Button,  Next: The Middle Mouse Button,  Up: Using the Mouse
  242. The Left Mouse Button
  243. ---------------------
  244.    The left mouse button is used to set the insertion point, select
  245. text to be operated on (e.g. cut or copied to the clipboard,
  246. reformatted, etc.), and perform actions associated with a highlighted
  247. block of text.  The gestures that can be performed using the mouse are
  248. "clicking" (pressing and releasing the button without moving the mouse),
  249. "double-clicking" and "triple-clicking" (rapidly clicking the button
  250. twice or three times in succession without moving the mouse),
  251. "dragging" (pressing the button, moving the mouse while the button is
  252. held down, and then releasing the button), and "double-dragging" and
  253. "triple-dragging" (like double-clicking and triple-clicking except that
  254. a drag is performed before the final release of the mouse button).
  255.    Clicking anywhere in the text normally sets the insertion point
  256. before the character that was clicked on (or at the end of a line if
  257. the click occurred beyond the end of a line), and a block cursor marks
  258. the location of the insertion point.  However, clicking on a highlighted
  259. block of text (e.g. a cross-reference in Info or a completion in the
  260. completion buffer) performs the action associated with the text (e.g.
  261. following the cross reference or selecting a completion).  In this
  262. context, "highlighted" means that the block of text is momentarily
  263. highlighted (typically by turning green) when the mouse passes over it.
  264. This should not be confused with the less transient sort of highlighting
  265. that occurs when you select a block of text by dragging the mouse over
  266. it. (This is usually indicated by marking the text gray.)  Note that, if
  267. you just want to set the insertion point in the middle of a highlighted
  268. block of text, hold down the `Control' key when clicking; this
  269. overrides any action that is associated with the text.
  270.    Here is a list of common sorts of highlighted text that have actions
  271. associated with them.
  272.    * A cross-reference in Info.
  273.    * A possible completion in the `*Completions*' buffer, when you hit
  274.      `Tab' or `Space' in the minibuffer.
  275.    * A file or directory in Dired.
  276.    * A compilation error or searching match, when you use `M-x compile'
  277.      or `M-x grep'.
  278.    * A buffer in buff-menu (a listing of current buffers that is
  279.      displayed using `C-x C-b').
  280.    Dragging the mouse over a block of text selects the text, and
  281. normally unselects any other text that may be selected.  However,
  282. holding down the Shift key when clicking or dragging first causes the
  283. old selected text (if any) and all text between the previous insertion
  284. point and the current mouse location to become part of the new
  285. selection.  This is called "Extending a Selection" and is commonly used
  286. as a way of selecting text without having to drag the mouse.
  287.    Double-clicking is a short-cut gesture that selects the word that
  288. surrounds or abuts the cursor; similarly, triple-clicking selects a
  289. line.  Double-dragging and triple-dragging select text a word at a time
  290. or a line at a time.  These latter gestures are often forgotten about,
  291. but can make selecting text much easier.
  292.    If there is more than one window on a screen, pressing the mouse
  293. button while over a modeline and then dragging causes the modeline to
  294. get dragged, thereby resizing the windows.
  295. File: winemacs,  Node: The Middle Mouse Button,  Next: The Right Mouse Button,  Prev: The Left Mouse Button,  Up: Using the Mouse
  296. The Middle Mouse Button
  297. -----------------------
  298.    On a three-button mouse, pressing the middle mouse button while some
  299. text is selected causes the selected text to be copied and inserted at
  300. the current mouse position.
  301.    Pressing the middle mouse button on a highlighted block of text
  302. normally causes the action associated with the text to be performed,
  303. just as if the left mouse button were clicked. (This exists for
  304. compatibility reasons.)
  305.    If you have a two-button mouse, the same functionality as the middle
  306. mouse button is available by holding down the `Meta' (i.e. `Alt') key
  307. and pressing the right button.
  308. File: winemacs,  Node: The Right Mouse Button,  Next: Drag-and-Drop,  Prev: The Middle Mouse Button,  Up: Using the Mouse
  309. The Right Mouse Button
  310. ----------------------
  311.    The right mouse button normally brings up a popup menu at the current
  312. mouse position.  The contents of the popup menu are dependent on the
  313. mode of the current buffer and usually contain commonly used commands
  314. for easy access.
  315.    Holding down the `Meta' key while pressing the right mouse button is
  316. equivalent to pressing the middle mouse button (see the previous
  317. section for details).
  318. File: winemacs,  Node: Drag-and-Drop,  Next: Remapping the Pointer,  Prev: The Right Mouse Button,  Up: Using the Mouse
  319. Drag-and-Drop
  320. -------------
  321.    You can drag files from the File Manager and drop them onto a
  322. Win-Emacs screen.  For each file dropped, a new screen will be created
  323. that is visiting that file.
  324. File: winemacs,  Node: Remapping the Pointer,  Prev: Drag-and-Drop,  Up: Using the Mouse
  325. Remapping the Pointer
  326. ---------------------
  327.    Win-Emacs doesn't actually think in terms of left, middle, and right
  328. buttons, but in terms of "button1", "button2", and "button3".  By
  329. default, button1 is the left button, button2 is the middle one, and so
  330. on; this results in the behavior described above.  However, you can
  331. change these associations using the `xmodmap.ini' file.  For example,
  332. you could make button2 be the right button and button3 be the middle
  333. one, and then pressing the middle button would bring up a pop-up menu
  334. and pressing the right one would insert the selected text at the
  335. current mouse position.  For details, *Note xmodmap.ini::.
  336. File: winemacs,  Node: Using the Menus,  Next: Dialog Boxes,  Prev: Using the Mouse,  Up: Overview of Win-Emacs
  337. Using the Menus
  338. ===============
  339.    Win-Emacs has a menubar that behaves like any other Windows menubar.
  340. It contains the most common editing commands for easy access.  The
  341. contents of the menubar can vary from buffer to buffer, and will change
  342. when you switch buffers; usually this variation consists of extra
  343. buffer-specific commands in some modes (e.g. W3 menus when you are in
  344. W3 mode).
  345.    Keyboard traversal using Alt in combination with letter keys is
  346. disabled because Alt is the same as Meta and is used for many keyboard
  347. commands.  However, you can still traverse to the menu with the
  348. keyboard by pressing and releasing the Alt key without any intervening
  349. keystrokes.
  350.    Win-Emacs also has popup menus that are accessible by pressing the
  351. right mouse button (*note The Right Mouse Button::.).
  352.    The menubar and popup menus are fully programmable.  For details,
  353. see the documentation for the E-Lisp variable `current-menubar' and the
  354. functions `popup-menu' and `popup-mode-menu'.  If you want to turn off
  355. the menubar, use the E-Lisp command `(set-menubar nil)'.
  356. File: winemacs,  Node: Dialog Boxes,  Next: Creating and Managing Multiple Screens,  Prev: Using the Menus,  Up: Overview of Win-Emacs
  357. Dialog Boxes
  358. ============
  359.    Win-Emacs currently has dialog boxes for changing the font of the
  360. screen and controlling printing.  These are accessible from the `Set
  361. Font...' option on the `Display' menu and the `Print...' and `Print
  362. Setup...' options on the `File' menu.
  363. File: winemacs,  Node: Creating and Managing Multiple Screens,  Prev: Dialog Boxes,  Up: Overview of Win-Emacs
  364. Creating and Managing Multiple Screens
  365. ======================================
  366.    Multiple windows ("screens" in Win-Emacs terminology) can be created
  367. by typing `C-x 5' or selecting `New Screen' from the `File' menu, and
  368. can be resized, moved around, and iconified independently from all
  369. other screens.  You can also create a new screen that is visiting a
  370. particular file by choosing `Open File in New Screen' from the `File'
  371. menu.  Closing a screen using the system menu in the upper-left corner
  372. of the screen will delete the screen if there is more than one, and
  373. quit Win-Emacs if there is only one screen.  You can also use the
  374. `Delete Screen' item on the `File' menu if there is more than one
  375. screen.
  376. File: winemacs,  Node: More About Win-Emacs,  Next: Other Packages,  Prev: Overview of Win-Emacs,  Up: Top
  377. More About Win-Emacs
  378. ********************
  379. * Menu:
  380. * Printing::                    Accessing the printer.
  381. * Syntax Highlighting::         Making your code easier to read.
  382. * Subprocesses::                Running other programs from Win-Emacs.
  383. * Network Connections::         Accessing other machines.
  384. * DDE Support::                 Communicating with other programs.
  385. * Editing Binary Files::        Editing .EXE files, .PIF files, etc.
  386. * Editing Files in Hex Mode::   Editing in traditional hex-dump mode.
  387. * MS-DOS Filenames::            Filenames under MS-DOS have limitations.
  388. * Low-Level PC Functions::      Violating the integrity of the system.
  389. File: winemacs,  Node: Printing,  Next: Syntax Highlighting,  Up: More About Win-Emacs
  390. Printing
  391. ========
  392.    Full WYSIWYG ("what you see is what you get") printing support and
  393. integration with Print Manager is provided.  Standard Print and Print
  394. Setup dialog boxes are provided to facilitate printer control; these are
  395. available from the `Print...' and `Print Setup...' options on the
  396. `File' menu or from the commands `M-x lpr-buffer' and `M-x lpr-region'.
  397. * Menu:
  398. * Notes About Printing:: Subtleties about printing are explained.
  399. * Printing Variables::   Controlling the appearance of printed output.
  400. * Printing Functions::   Accessing the printer from E-Lisp.
  401. File: winemacs,  Node: Notes About Printing,  Next: Printing Variables,  Up: Printing
  402. Notes About Printing
  403. --------------------
  404.    You may notice that lines of printed output are spaced somewhat
  405. differently than lines on the Emacs display.  Lines on the Emacs display
  406. are always spaced at a constant distance, so that if one line contains
  407. characters in a large font, all lines in the buffer will be spaced at a
  408. large distance even if they contain only characters in a small font.
  409. Lines of printed output are spaced variably according to the sizes of
  410. fonts that appear in those lines.
  411.    Begin-glyph and end-glyph objects (graphic symbols which can be
  412. attached to a range of Emacs text - see the Emacs `NEWS' file for
  413. details) are not printed.  We may fix this at a later time.
  414.    Your printed output will best match the screen display if you use
  415. TrueType fonts.
  416. File: winemacs,  Node: Printing Variables,  Next: Printing Functions,  Prev: Notes About Printing,  Up: Printing
  417. Printing Variables
  418. ------------------
  419.    Several Emacs variables control the appearance of printed output.
  420.    The variables `print-margin-left', `print-margin-right',
  421. `print-margin-top', and `print-margin-bottom' hold floating-point
  422. numbers representing the margins for printing.  Each has a default
  423. value of 0.0.  The variable `print-margin-units' holds either the
  424. symbol `cm' or `inch' representing the units in which the margin values
  425. are to be interpreted.
  426.    The variable `print-wrap' holds a Boolean value (`t' or `nil') and
  427. controls how lines which are too wide for the printed page are printed.
  428. If `print-wrap' is `t', a line which is too wide will wrap around to
  429. the next printed line; if `nil', then a line which is too wide will be
  430. truncated at the right margin.  The `print-wrap' variable affects
  431. printed output just as the `truncate-lines' variable affects the
  432. display of Emacs buffers on the screen.
  433. File: winemacs,  Node: Printing Functions,  Prev: Printing Variables,  Up: Printing
  434. Printing Functions
  435. ------------------
  436.    This section is only of interest if you are writing Emacs-Lisp code.
  437.  - Command: win-print-region START END &optional BUFFER SCREEN JOBNAME
  438.      This function prints the contents of a region of a buffer after
  439.      displaying the Print dialog box.  The Lisp code for the Print
  440.      Buffer menu item calls this function.
  441.      Arguments START and END specify the region to print.  BUFFER is
  442.      the buffer.  SCREEN is the screen which is used for mapping faces
  443.      to fonts. (Because each screen has its own face-to-font mapping, a
  444.      buffer may appear different in two different screens.) JOBNAME is
  445.      the print job name which will appear in Print Manager (max 31
  446.      characters).
  447.      BUFFER, SCREEN, and JOBNAME are optional, and default to the
  448.      current buffer, the selected screen, and a name constructed from
  449.      the buffer name, respectively.
  450.      If there is a selected region, the `Selection' choice in the dialog
  451.      box will be enabled and chosen by default; otherwise, it will be
  452.      disabled.  When `Selection' is the default and the user chooses
  453.      `All', the entire visible portion of the buffer will be printed.
  454.      Returns `t' if the document was successfully printed, `nil'
  455.      otherwise (i.e. the user canceled the operation).
  456.  - Command: win-print-setup
  457.      This function displays the Print Setup dialog box.  It takes no
  458.      arguments.
  459. File: winemacs,  Node: Syntax Highlighting,  Next: Subprocesses,  Prev: Printing,  Up: More About Win-Emacs
  460. Syntax Highlighting
  461. ===================
  462.    "Syntax highlighting" refers to decorations placed on parts of code
  463. to make it easier to read.  For example, comments might be displayed in
  464. red, strings in green, and function names in function definitions in
  465. blue.  Syntax highlighting makes it so much easier to read code that,
  466. once you get used to it, you may find it strange to read unadorned code.
  467.    Syntax highlighting is accomplished in Win-Emacs using the
  468. "font-lock" package.  You can switch into font-lock mode using the
  469. command `M-x font-lock-mode'.  This causes the buffer to be fontified;
  470. afterwards, any new text you enter will be fontified on-the-fly.  If at
  471. any point you want to refresh the fontification in a buffer, use the
  472. commands `M-x font-lock-fontify-buffer' or `M-x
  473. font-lock-fontify-region'.
  474.    The default decorations for font-lock are done using italicized,
  475. boldfaced, and underlined fonts.  If you are on a color display, you
  476. will probably find it prettier to use colors instead.  Here is some
  477. E-Lisp code you can add to your `emacs.ini' file to do this:
  478.      (require 'font-lock)
  479.      (set-face-foreground 'font-lock-function-name-face "blue")
  480.      (set-face-foreground 'font-lock-comment-face "red")
  481.      (set-face-foreground 'font-lock-string-face "forest green")
  482.      (set-face-underline-p 'font-lock-string-face nil)
  483.      (make-face-unitalic 'font-lock-string-face)
  484.      (make-face-unitalic 'font-lock-function-name-face)
  485.      (make-face-unitalic 'font-lock-comment-face)
  486.      (copy-face 'font-lock-function-name-face 'font-lock-keyword-face)
  487.      (copy-face 'font-lock-string-face 'font-lock-doc-string-face)
  488.      (copy-face 'font-lock-string-face 'font-lock-type-face)
  489.    Experiment with the colors and fonts if you like (for more details,
  490. *note Customization::.).
  491.    Once you get used to font-lock, you will probably want it to happen
  492. automatically when you visit a file containing code.  Here is some code
  493. for your `emacs.ini' file to do so:
  494.      (defun turn-on-font-lock ()
  495.        (font-lock-mode 1))
  496.      (add-hook 'emacs-lisp-mode-hook    'turn-on-font-lock)
  497.      (add-hook 'lisp-mode-hook    'turn-on-font-lock)
  498.      (add-hook 'c-mode-hook        'turn-on-font-lock)
  499.      (add-hook 'c++-mode-hook    'turn-on-font-lock)
  500.      (add-hook 'perl-mode-hook    'turn-on-font-lock)
  501.      (add-hook 'tex-mode-hook    'turn-on-font-lock)
  502.      (add-hook 'texinfo-mode-hook    'turn-on-font-lock)
  503.    Both of these code fragments are available in the sample `emacs.ini'
  504. file in the `etc' subdirectory of the distribution.
  505. File: winemacs,  Node: Subprocesses,  Next: Network Connections,  Prev: Syntax Highlighting,  Up: More About Win-Emacs
  506. Subprocesses
  507. ============
  508.    You can run another program from Win-Emacs and optionally have its
  509. output placed in a buffer or otherwise processed.  This allows you to
  510. perform any action you want on the text and build up very powerful
  511. packages. (Note! Subprocess support does not currently work under
  512. Windows NT.)
  513.    Under Windows, there are two kinds of programs: native Windows
  514. applications and MS-DOS applications running in a DOS box.  Native
  515. Windows applications are started from Win-Emacs using `win-exec' and
  516. execute "asynchronously", meaning they run concurrently with Win-Emacs
  517. (just as if you had started the application from Program Manager).  DOS
  518. applications are run from Win-Emacs using `shell-command' and friends,
  519. and execute "synchronously", meaning that Win-Emacs waits until the
  520. application finishes before proceeding.  The reason that Win-Emacs
  521. waits is so that it can retrieve the output from DOS command.
  522.    It is not currently possible to run a DOS application asynchronously
  523. and have Win-Emacs pass input to it or retrieve output from it while it
  524. is running.  However, if you don't care about the output (or arrange to
  525. retrieve it yourself, rather than have Win-Emacs do it for you), you
  526. can go ahead and start a DOS application asynchronously using
  527. `win-exec', just as if it were a Windows application.  (If you do this,
  528. you might want to create a PIF file to get more control over the
  529. application.  See the `Microsoft Windows User's Guide' for more
  530. information.)
  531. * Menu:
  532. * Running a DOS Process::       These run synchronously.
  533. * compile/grep/diff::           Interface to compilers and utilities.
  534. * Running a Windows Process::   These run asynchronously.
  535. * Controlling Subprocesses::    Specifying how a subprocess runs.
  536. File: winemacs,  Node: Running a DOS Process,  Next: compile/grep/diff,  Up: Subprocesses
  537. Running a DOS Process
  538. ---------------------
  539.    To run a DOS process and have its output inserted in a buffer, use
  540. `M-!' (or equivalently `M-x shell-command').  For example, if you type
  541. `M-! mem RET' then you will get a buffer containing something like this:
  542.      Memory Type        Total  =   Used  +   Free
  543.      ----------------  -------   -------   -------
  544.      Conventional         640K      210K      430K
  545.      Upper                 91K       91K        0K
  546.      Reserved             384K      384K        0K
  547.      Extended (XMS)    15,269K   14,245K    1,024K
  548.      ----------------  -------   -------   -------
  549.      Total memory      16,384K   14,930K    1,454K
  550.      
  551.      Total under 1 MB     731K      301K      430K
  552.      
  553.      Total Expanded (EMS)                1,024K (1,048,576 bytes)
  554.      Free Expanded (EMS)                 1,024K (1,048,576 bytes)
  555.      
  556.      Largest executable program size       430K (440,528 bytes)
  557.      Largest free upper memory block         0K       (0 bytes)
  558.      MS-DOS is resident in the high memory area.
  559.    This is the output from the DOS `mem' program, which reports
  560. information about DOS memory usage.
  561.    You can also use a DOS application as a "filter", meaning that some
  562. text is given as input to the program and its output replaces the text.
  563. To filter some text through a DOS application, select the text and
  564. then type `M-|' (or equivalently, `M-x shell-command-on-region').
  565.    For example, say you wanted to sort some lines of text.  One way to
  566. do it is to select the text and then type `M-| sort RET'.  This passes
  567. the text through the DOS `sort' program, which sorts its input and
  568. outputs the result.
  569.    If you run a DOS subprocess and it hangs, Emacs normally will wait
  570. forever, expecting it to finish.  You can break out of this by pressing
  571. `C-g'.
  572. File: winemacs,  Node: compile/grep/diff,  Next: Running a Windows Process,  Prev: Running a DOS Process,  Up: Subprocesses
  573. compile/grep/diff
  574. -----------------
  575.    Built on top of Emacs' subprocess support are packages that provide
  576. interfaces to compilers and to the standard Unix utilities `grep' (for
  577. searching for text in one or multiple files) and `diff' (for detecting
  578. differences between two text files).  Because `grep' and `diff' do not
  579. come as part of DOS, Win-Emacs provides 32-bit ports of the GNU
  580. versions of them. (The GNU utilities are compatible with the original
  581. Unix ones but generally are faster, more powerful, and more robust.)
  582. Because these utilities run in 32-bit mode, you will not encounter
  583. memory limitations that might otherwise, for example, make it
  584. impossible to run `diff' to compare large text files.
  585.    To run the compiler, use the command `M-x compile'.  You will be
  586. prompted for a command line to run the compiler (e.g. `make'), and then
  587. the compiler will be run as a subprocess.  When it finishes, any errors
  588. that were generated will be parsed and placed in a special compilation
  589. output buffer.  If you click on any error in the buffer, or hit `C-x `'
  590. to access the next error in sequence, Win-Emacs visits the file
  591. containing the error and jumps to the line in that file where the error
  592. occurred.  This allows you to very quickly locate and correct errors
  593. and then recompile.
  594.    `M-x grep' works very similarly to `M-x compile'.  You are prompted
  595. for a command line to run `grep', and all matches that are found are
  596. displayed in a buffer.  Clicking on a match or using `C-x `' brings you
  597. to the file and location within the file where the match occurred.
  598.    `M-x diff' prompts you for the filenames to compare, and then
  599. displays the resulting differences in a special buffer, one difference
  600. at a time.  There are keyboard commands to display the next or previous
  601. difference, jump to a numbered difference, etc.  For details, type `C-h
  602. m' when in the diff buffer.
  603. File: winemacs,  Node: Running a Windows Process,  Next: Controlling Subprocesses,  Prev: compile/grep/diff,  Up: Subprocesses
  604. Running a Windows Process
  605. -------------------------
  606.    You can start a Windows application using the E-Lisp function
  607. `win-exec'.
  608.  - Function: win-exec PROGRAM SHOW-STATE &optional ARGS
  609.      This function runs the Windows program PROGRAM and doesn't wait
  610.      for it to finish.  Second argument SHOW-STATE specifies how the
  611.      program's window will be shown, and should be one of the following
  612.      symbols:
  613.     `win-show-hide'
  614.           Hide the window, don't change focus.
  615.     `win-show-min'
  616.     `win-show-min-focus'
  617.     `win-show-min-focus-next'
  618.           Minimize the window; don't change the focus, focus on the
  619.           window, and focus on the next top-level window, respectively.
  620.     `win-show-max-focus'
  621.           Maximize the window and focus on it.
  622.     `win-show-normal'
  623.     `win-show-normal-focus'
  624.           Show the window in its normal state (not maximized or
  625.           minimized); don't change the focus or focus on the window,
  626.           respectively.
  627.     `win-show-current'
  628.     `win-show-current-focus'
  629.           If the window was hidden, set it to its previously shown
  630.           state; otherwise don't change the state.  Don't change the
  631.           focus or focus on the window, respectively.
  632.      Some of the above values only make sense if an instance of the
  633.      program is already running.  Note that the display-state specified
  634.      here is only a suggestion to the program, which is free to ignore
  635.      or reinterpret it.
  636.      Any remaining arguments are the parameters passed to the program.
  637. File: winemacs,  Node: Controlling Subprocesses,  Prev: Running a Windows Process,  Up: Subprocesses
  638. Controlling Subprocesses
  639. ------------------------
  640.    DOS processes use the PIF file `spr.pif' in the `etc' subdirectory.
  641. By modifying this file using PIF Editor, you can control the way a DOS
  642. process is invoked.
  643.    The current directory of the DOS process is the default directory of
  644. the buffer that was current when the process was started.  Normally
  645. this is the directory that the buffer's file is located in, but this
  646. can be changed with the `M-x cd' command.
  647.    The following variables control how a DOS process is run.
  648.  - Variable: exec-directory
  649.      This variable specifies the directory that holds the programs that
  650.      come with Win-Emacs, such as `grep' and `diff'.  This is the full
  651.      pathname of the `etc' subdirectory.
  652.  - Variable: exec-path
  653.      This variable contains a list of directories to search programs to
  654.      run in subprocesses.  Each element is a string (directory name) or
  655.      `nil' (try default directory).  In Win-Emacs, this is initialized
  656.      from the `PATH' environment variable and has the value of
  657.      EXEC-DIRECTORY prepended. (This way, incompatible applications
  658.      sitting elsewhere in the search path with names like `grep.exe' or
  659.      `diff.exe' will not mess up `M-x grep' or `M-x diff'.)
  660.  - Variable: msdos-shells
  661.      This variable holds a list of DOS shell programs that use the
  662.      `command.com'-style method of specifying a command to be executed
  663.      (i.e. `/c' followed by a command with backslashes as directory
  664.      separators).  By default, this lists `command.com', `4dos.com',
  665.      and `ndos.com'.  Do *not* add shells such as the MKS `sh.exe' to
  666.      this list; it uses Unix-style specifications.
  667.  - Variable: win-dos-process-show-state
  668.      This variable specifies the show state for invoked DOS processes.
  669.      This is the second parameter in the call to the Windows function
  670.      `WinExec()'.  The possible values are the same as those for the
  671.      SHOW-STATE argument to the E-Lisp `win-exec' function (*note
  672.      Running a Windows Process::.).
  673. File: winemacs,  Node: Network Connections,  Next: DDE Support,  Prev: Subprocesses,  Up: More About Win-Emacs
  674. Network Connections
  675. ===================
  676.    Win-Emacs can connect to services provided by other machines on the
  677. local network or the global Internet.  Win-Emacs uses Windows Sockets, a
  678. standard protocol which allows Windows applications to talk to networks.
  679. If you have `winsock.dll' (the library which implements Windows
  680. Sockets) installed on your computer, you can use Win-Emacs to access
  681. network services.
  682.    Many packages are available for Win-Emacs that allow you to read
  683. network news, access remote mail, etc.  The Emacs Lisp distribution
  684. included with Win-Emacs includes GNUS, a package that allows you to
  685. read network news using NNTP (Network News Transfer Protocol), and W3,
  686. a package that lets you browse the World Wide Web.  You can find more
  687. Emacs Lisp network packages on the Internet (*note Other Packages::.).
  688.    If you are interested in writing Emacs-Lisp code to access the
  689. network, see the documentation for the E-Lisp function
  690. `open-network-stream', which is used to open a network connection.
  691. Like other versions of GNU Emacs, Win-Emacs uses process objects to
  692. represent open network connections.  Win-Emacs currently does not
  693. support asynchronous subprocesses, so in fact every process object under
  694. Win-Emacs represents a network connection, and `open-network-stream' is
  695. the only way to create process objects.  See the Emacs Lisp
  696. documentation for details about functions which operate on process
  697. objects.
  698.    If a network error occurs, Win-Emacs will signal a `winsock-error'
  699. with an accompanying error message.
  700. File: winemacs,  Node: DDE Support,  Next: Editing Binary Files,  Prev: Network Connections,  Up: More About Win-Emacs
  701. DDE Support
  702. ===========
  703.    This section is only of interest if you are writing Emacs-Lisp code.
  704.    Using Emacs Lisp, you can use DDE (Dynamic Data Exchange) to exchange
  705. data between Win-Emacs and other Windows applications.  Emacs can
  706. exchange data in text format only.
  707. * Menu:
  708. * Intro to DDE::        Background information.
  709. * DDE Client::          Using Emacs as a DDE client.
  710. * DDE Server::          Using Emacs as a DDE server.
  711. * DDE Example::         Sample code to make things clearer.
  712. File: winemacs,  Node: Intro to DDE,  Next: DDE Client,  Up: DDE Support
  713. Intro to DDE
  714. ------------
  715.    The Emacs Lisp data type handle represents open DDE connections and
  716. asynchronous DDE transactions.  The functions `dde-connect',
  717. `dde-execute' and `dde-request', below, return handle objects.  The
  718. only operation you can perform on handles is to compare two handles
  719. using `equal'. (Internally, a handle holds a 32-bit integer
  720. representing a Windows handle.)
  721.    Please note that all service, topic, and item names in DDE are
  722. case-insensitive.
  723. File: winemacs,  Node: DDE Client,  Next: DDE Server,  Prev: Intro to DDE,  Up: DDE Support
  724. DDE Client
  725. ----------
  726.    The following Emacs Lisp functions allow Emacs to act as a DDE
  727. client.
  728.  - Function: dde-connect SERVICE TOPIC
  729.      This function initiates a conversation with a DDE server.  The DDE
  730.      server application must already be running.  SERVICE is a string
  731.      naming the DDE server to connect to; typically, this is just the
  732.      name of the DDE server application.  TOPIC is a string naming the
  733.      topic for the DDE conversation.  Most DDE servers support the
  734.      `System' topic.  Consult the documentation for your DDE server
  735.      application to find out what topics it supports.
  736.      This functions returns a handle object representing the DDE
  737.      conversation.  You can pass this object to other DDE functions
  738.      such as `dde-execute' and `dde-request'.
  739.  - Function: dde-execute HANDLE COMMAND TIMEOUT
  740.      This function sends a command to a DDE server.  HANDLE is a handle
  741.      which was returned by a previous call to `dde-connect'.  COMMAND
  742.      is a command string to be sent to the DDE server.  For a
  743.      synchronous transaction, TIMEOUT is the maximum time, in
  744.      milliseconds, to wait for a reply from the server.  For an
  745.      asynchronous transaction, TIMEOUT is 0.
  746.      For a synchronous transaction, this function returns `t' if the
  747.      command execution succeeds, and signals a `dde-error' if the
  748.      command execution fails or times out.  For an asynchronous
  749.      transaction, this function immediately returns a handle
  750.      representing the transaction; when the server has executed the
  751.      command, Emacs calls the function contained in the
  752.      `dde-acknowledge' variable; see details below.
  753.  - Function: dde-request HANDLE ITEM TIMEOUT
  754.      This function requests data from a DDE server.  HANDLE is a handle
  755.      which was returned by a previous call to `dde-connect'.  ITEM is a
  756.      string naming the item to request from the server.  For a
  757.      synchronous transaction, TIMEOUT is the maximum time, in
  758.      milliseconds, to wait for a reply from the server.  For an
  759.      asynchronous transaction, TIMEOUT is 0.
  760.      For a synchronous transaction, this function returns a string
  761.      containing the requested data if the command execution succeeds,
  762.      and signals a `dde-error' if the request fails or times out.  For
  763.      an asynchronous transaction, this function immediately returns a
  764.      handle representing the transaction; when the server replies with
  765.      the data, Emacs calls the function contained in the
  766.      DDE-ACKNOWLEDGE variable; see details below.
  767.  - Variable: dde-acknowledge
  768.      When a server completes an asynchronous request made with
  769.      `dde-execute' or `dde-request', Emacs calls the function contained
  770.      in the `dde-acknowledge' variable.  This function is called with 4
  771.      arguments: HANDLE, TOPIC, ITEM, and DATA.  HANDLE is a handle
  772.      returned by `dde-execute' or `dde-request' and indicates the
  773.      transaction which is being answered.  TOPIC is the topic name of
  774.      the conversation in which the transaction was performed.  ITEM is
  775.      the item name passed to `dde-request', or is `nil' if the request
  776.      was made with `dde-execute'.  For a command execution, DATA is `t'
  777.      if the command execution succeeded, or `nil' if it failed.  For a
  778.      data request, DATA is a string containing the requested data, or
  779.      `nil' if the request failed.
  780.      If `dde-acknowledge' is `nil', Emacs simply ignores any
  781.      transaction acknowledgements.  The default value for
  782.      `dde-acknowledge' is `nil'.
  783.  - Function: dde-disconnect HANDLE
  784.      This function terminates a DDE connection.  HANDLE is a handle
  785.      which was returned by `dde-connect'.
  786. File: winemacs,  Node: DDE Server,  Next: DDE Example,  Prev: DDE Client,  Up: DDE Support
  787. DDE Server
  788. ----------
  789.    Windows applications can initiate conversations with Emacs as a DDE
  790. server, and can ask Emacs to execute Emacs Lisp code.  You can use Emacs
  791. Lisp to extend Emacs' behavior as a DDE server.
  792.    The default behavior of Emacs as a DDE server is simple.  A Windows
  793. application can initiate a DDE conversation with Emacs using the service
  794. name `Emacs' and the topic name `System'.  An application can send a
  795. DDE command of the form `[lispCode]' to ask Emacs to execute Emacs Lisp
  796. code.  For example, the command `[(beep)]' will cause Emacs to beep.
  797.    By default, Emacs also responds to several standard DDE requests
  798. under the `System' topic as follows:
  799. `formats'
  800.      Sends a list of data formats Emacs supports: only `Text'.
  801. `help'
  802.      Sends text explaining how to execute Emacs Lisp commands through
  803.      DDE.
  804. `topics'
  805.      Sends a list of DDE topics Emacs supports; initially, only
  806.      `System'.
  807.    The Lisp code in `ddeservr.el' implements the default DDE server
  808. behavior described above.  You can change this code to support different
  809. kinds of DDE requests.  For example, you could add code which would
  810. allow client applications to retrieve text from Emacs buffers or to
  811. inquire about the values of Emacs Lisp variables.
  812.  - Variable: dde-topics
  813.      This variable contains a list of strings representing topic names
  814.      on which Emacs will accept DDE connections.  Initially,
  815.      `dde-topics' contains only `System'.  You can add strings to
  816.      `dde-topics' to allow Emacs to accept connections on other topics.
  817.      If `dde-topics' is `t', Emacs will accept conversations on any
  818.      topic.
  819.  - Variable: dde-server-execute
  820.      When a DDE command execution request arrives, Emacs calls the
  821.      function contained in this variable to process the request.  The
  822.      function receives 3 arguments: CONV, TOPIC and ITEM.  CONV is a
  823.      handle representing the conversation in which the request was made
  824.      (you will probably want to ignore this value except in exceptional
  825.      circumstances in which you want to see which requests came from a
  826.      single conversation).  TOPIC is a string representing the
  827.      conversation topic, and ITEM is a string representing the command
  828.      to execute.  The function should return a Boolean value
  829.      representing whether the command execution was succesful.  If any
  830.      error occurs during the execution of the function in
  831.      `dde-server-execute', a command execution failure will immediately
  832.      be reported to the DDE client.
  833.      The code in `ddeservr.el' defines `dde-server-execute' to contain
  834.      a function which processes DDE commands of the form `[lispCode]'
  835.      as described above.
  836.  - Variable: dde-server-request
  837.      When a DDE data request arrives, Emacs calls the function
  838.      contained in this variable to process the request.  The function
  839.      receives 3 arguments: CONV, TOPIC and ITEM.  CONV is a handle
  840.      representing the conversation in which the request was made.
  841.      TOPIC is a string representing the conversation topic, and ITEM is
  842.      a string representing the requested data item.  The function
  843.      should return a string containing the data to return to the client
  844.      application, or `nil' to deny the request.
  845.      The code in `ddeservr.el' defines `dde-server-request' to process
  846.      the standard DDE system requests as described above.
  847. File: winemacs,  Node: DDE Example,  Prev: DDE Server,  Up: DDE Support
  848. DDE Example
  849. -----------
  850.    The Lisp file `ddeexamp.el' in the `samples' subdirectory contains
  851. some examples of Emacs Lisp code that uses DDE.
  852. File: winemacs,  Node: Editing Binary Files,  Next: Editing Files in Hex Mode,  Prev: DDE Support,  Up: More About Win-Emacs
  853. Editing Binary Files
  854. ====================
  855. * Menu:
  856. * Intro to File Types::         Text vs. binary files.
  857. * Controlling the File Type::
  858. * Lisp-Level File Type Info::
  859.